#ifndef _CAMERA
#define _CAMERA

// INCLUDES --------------------------------------------------------------------
#include "Base.h"
#include "Vector4.h"

// TYPEDEFS --------------------------------------------------------------------

// POSSIBLY PRIVATE

// camera types
#define CAMERATYPE_PERSPECTIVE    0
#define CAMERATYPE_ORTHOGONAL     1

// viewing parameters default values
#define FOV_DEFAULT               25.0f
#define NEARCLIPPINGPLANE_DEFAULT 0.1f
#define FARCLIPPINGPLANE_DEFAULT  1000.0f

// camera structure
typedef struct
{
  union
  {
    // component style
    Vector4 position, // camera position, default: [0,0,5]
            lookat,   // lookAt position, default: [0,0,0]
            up;       // up axis,         default: [0,1,0] -> Y is up

    // array style
    Vector4 c[3];     // position, lookat, up axis
  }
  // camera type
  ui16 cameraType;        // ortho/perspective,   default: perspective

  // viewing parameters
  fp32 fieldOfView,       // field of view,       default: 25.0f
       nearClippingPlane, // near clipping plane, default: 0.1f
       farClippingPlane;  // far clipping plane,  default: 1000.0f
  
} Camera;

// FUNCTIONS -------------------------------------------------------------------

/* GENERAL:
   d    -> destination
   s    -> source
   size -> array size (0,1 for single elements)

   a,b  -> two arbitrary vertices
   k    -> floating point scalar
*/

// POSSIBLY PRIVATE
void CameraClear(Camera *c, ui32 size);            // clear to defaults
void CameraCopy (Camera *d, Camera *s, ui32 size); // clone camera src->dest

/* FIRST 4 CAMERAS ARE DEFAULT CREATES:
   1 - front     [0,0,5],[0,0,0],[0,1,0] orthogonal
   2 - left side [5,0,0],[0,0,0],[0,1,0] orthogonal
   3 - top       [0,5,0],[0,0,0],[0,1,0] orthogonal
   4 - front     [0,0,5],[0,0,0],[0,1,0] perspective <- default camera
   
   CHECK MAYA FOR CORRECT VALUES
*/

// ------------------------------------------------------------------
void CameraSetActive(ui32 index);

void CameraUpdate();

void CameraSetPosition  (Vector *p, Vector *t, Vector *up);
void CameraSetType      (ui16 type);
void CameraSetParameters(fp32 fov, fp32 nPlane, fp32 fPlane);

#endif // _CAMERA
